package com.lcf.framework.permission;

import cn.dev33.satoken.stp.StpInterface;
import com.lcf.common.utils.UserUtils;
import com.lcf.feign.service.system.SysSaTokenFeignService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 描述：自定义权限验证接口扩展
 *
 * @author lcf
 * @since 2025/2/21 23:48
 */
@Component
public class StpInterfaceImpl implements StpInterface {
    @Resource
    private SysSaTokenFeignService service;

    /**
     * 返回此 loginId 拥有的权限列表
     */
    @Override
    public List<String> getPermissionList(Object loginId, String loginType) {
        return service.getPermissionList(loginId, UserUtils.getTenantId());
    }

    /**
     * 返回此 loginId 拥有的角色列表
     */
    @Override
    public List<String> getRoleList(Object loginId, String loginType) {
        return service.getRoleList(loginId, UserUtils.getTenantId());
    }
}
